const state = {
  goodAttr: {},
  showAttr: false,
  region: '',
  today: 1024,
  rArea: {},
  nowBuy: 0,
  teamId: 0,
  date: '',
  time: '',
  timeActive: false,
  convert: ''
};
const actions = {};
const mutations = {
  teamId(state, id) {
    sessionStorage.setItem('teamId', JSON.stringify(id));
    state.teamId = JSON.parse(sessionStorage.getItem('teamId'));
  },
  goodAttr(state, good) {
    sessionStorage.setItem('goodAttr', JSON.stringify(good));
    state.goodAttr = JSON.parse(sessionStorage.getItem('goodAttr'));
  },
  showAttr(state, sta) {
    sessionStorage.setItem('showAttr', JSON.stringify(sta));
    state.showAttr = JSON.parse(sessionStorage.getItem('showAttr'));
  },
  nowBuy(state, sta) {
    sessionStorage.setItem('nowBuy', JSON.stringify(sta));
    state.nowBuy = JSON.parse(sessionStorage.getItem('nowBuy'));
  },
  rArea(state, sta) {
    sessionStorage.setItem('rArea', JSON.stringify(sta));
    state.rArea = JSON.parse(sessionStorage.getItem('rArea'));
  },
  region(state, sta) {
    sessionStorage.setItem('region', JSON.stringify(sta));
    state.region = JSON.parse(sessionStorage.getItem('region'));
  },
  convert(state, sta) {
    sessionStorage.setItem('convert', JSON.stringify(sta));
    state.convert = JSON.parse(sessionStorage.getItem('convert'));
  },
  chooseDate(state, sta) {
    sessionStorage.setItem('date', JSON.stringify(sta));
    state.date = JSON.parse(sessionStorage.getItem('date'));
  },
  today(state, sta) {
    sessionStorage.setItem('today', JSON.stringify(sta));
    state.today = JSON.parse(sessionStorage.getItem('today'));
  },
  time(state, sta) {
    sessionStorage.setItem('time', JSON.stringify(sta));
    state.time = JSON.parse(sessionStorage.getItem('time'));
  },
  timeActive(state, sta) {
    sessionStorage.setItem('timeActive', JSON.stringify(sta));
    state.timeActive = JSON.parse(sessionStorage.getItem('timeActive'));
  }
};

export default {
  state,
  actions,
  mutations
};
